package com.ae.observer;

import java.util.ArrayList;

public class Observable implements QuackObservable {

	ArrayList<Observer> observers = new ArrayList<Observer>(); 
	QuackObservable duck ; 
	
	public Observable(QuackObservable duck) {
		this.duck = duck ; 
	}
	
	@Override
	public void registerObserver(Observer o) {
		observers.add(o);		
	}

	@Override
	public void notifyObserver() {
		for ( Observer o : observers ) {
			o.update(duck);
		}
		
	}
	

}
